//
//  WithdrawalCell.m
//  阿帕
//
//  Created by mac on 2020/4/22.
//  Copyright © 2020 GCY. All rights reserved.
//

#import "WithdrawalCell.h"

@interface WithdrawalCell ()
@property (weak, nonatomic) IBOutlet UILabel *tiXianTextLabel;
@property (weak, nonatomic) IBOutlet UILabel *tiXianStatusLabel;
@property (weak, nonatomic) IBOutlet UILabel *moneyLabel;
@property (weak, nonatomic) IBOutlet UILabel *remarkLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UILabel *rejectResaonLabel;
@property (weak, nonatomic) IBOutlet UIView *bLine;

@end

@implementation WithdrawalCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    _tiXianTextLabel.textColor = Dark_TextColor;
    _moneyLabel.textColor = Dark_TextColor;
    _remarkLabel.textColor = Dark_TextColor;
    _dateLabel.textColor = Light_TextColor;
    _rejectResaonLabel.textColor = Dark_TextColor;
    _bLine.backgroundColor = BackgroundColor;
    [_statusButton setBackgroundColor:[UIColor whiteColor]];
    [_statusButton setTitleColor:Theme_ColorValue forState:UIControlStateNormal];
    
    _remarkLabel.adjustsFontSizeToFitWidth = YES;
    _rejectResaonLabel.adjustsFontSizeToFitWidth = YES;
    
    _remarkLabel.numberOfLines = 2;
    _rejectResaonLabel.numberOfLines = 2;
    
    [DCSpeedy dc_chageControlCircularWith:_statusButton AndSetCornerRadius:12.5f SetBorderWidth:1 SetBorderColor:Theme_ColorValue canMasksToBounds:YES];
}

- (void)setModel:(WithdrawalRecordModel *)model {
    
//     WAIT_AUDIT：待审核，AUDITED：已审核，REJECT：驳回，DEALING:处理中，SUCCESS：成功,FAIL：失败,
    _model = model;
    
    [StatusTextJudge withdrawalRecordStatusJudge:_tiXianStatusLabel withStatus:model.status];
    _moneyLabel.text = CJStringWithFormat(@"%.2f", [model.totalAmount floatValue]);
    _remarkLabel.text = [DCSpeedy isBlankString:model.memo] == YES ? @"备注：暂无" : CJStringWithFormat(@"备注：%@", model.memo);
    _dateLabel.text = model.gmtCreated;
    _rejectResaonLabel.text = CJStringWithFormat(@"驳回理由：%@", model.errorDesc);
    
    if ([model.status isEqual:@"REJECT"] || [model.status isEqual:@"FAIL"]) {
        _rejectResaonLabel.hidden = NO;
    } else {
        _rejectResaonLabel.hidden = YES;
    }
    
    if ([model.status isEqual:@"DEALING"]) {
        _statusButton.hidden = NO;
        [_statusButton setTitle:@"刷新状态" forState:UIControlStateNormal];
    } else if ([model.status isEqual:@"AUDITED"]) {
        _statusButton.hidden = NO;
        [_statusButton setTitle:@"立即打款" forState:UIControlStateNormal];
    } else if ([model.status isEqual:@"FAIL"]) {
        _statusButton.hidden = YES;
        
//        _statusButton.hidden = NO;
//        [_statusButton setTitle:@"重新提现" forState:UIControlStateNormal];
    } else {
        _statusButton.hidden = YES;
    }
    
    
    if ([model.status isEqual:@"FAIL"] || [model.status isEqual:@"REJECT"]) {
        model.cellHeight = 180;
    } else {
        model.cellHeight = 120;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
